import 'package:json_annotation/json_annotation.dart';

@JsonSerializable()
class RoomRecordingProperty {
  String name;
  bool hasAudio;
  bool hasVideo;
  String outputMode;
  String recordingLayout;
  String resolution;
  int frameRate;
  int shmSize;
  RoomRecordingProperty({
    this.name,
    this.hasAudio,
    this.hasVideo,
    this.outputMode,
    this.recordingLayout,
    this.resolution,
    this.frameRate,
    this.shmSize,
  });

  factory RoomRecordingProperty.fromJson(Map<String, dynamic> json) {
    return RoomRecordingProperty(
      name: json["name"] as String,
      hasAudio: json["hasAudio"] as bool,
      hasVideo: json["hasVideo"] as bool,
      outputMode: json["outputMode"] as String,
      recordingLayout: json["recordingLayout"] as String,
      resolution: json["resolution"] as String,
      frameRate: json["frameRate"] as int,
      shmSize: json["shmSize"] as int,
    );
  }
}

@JsonSerializable()
class RoomConnections {
  int numberOfElements;
  List content;

  RoomConnections({
    this.numberOfElements,
    this.content,
  });

  factory RoomConnections.fromJson(Map<String, dynamic> json) {
    return RoomConnections(
      numberOfElements: json["numberOfElements"] as int,
      content: json["object"] as List,
    );
  }
}

@JsonSerializable()
class RoomInfo {
  String id;
  String object;
  String sessionId;
  int createdAt;
  String mediaMode;
  String recordingMode;
  RoomRecordingProperty defaultRecordingProperties;
  String customSessionId;
  RoomConnections connections;
  bool recording;
  String forcedVideoCodec;
  bool allowTranscoding;

  RoomInfo({
    this.id,
    this.object,
    this.sessionId,
    this.createdAt,
    this.mediaMode,
    this.recordingMode,
    this.defaultRecordingProperties,
    this.customSessionId,
    this.connections,
    this.recording,
    this.allowTranscoding,
    this.forcedVideoCodec,
  });

  factory RoomInfo.fromJson(Map<String, dynamic> json) {
    return RoomInfo(
      id: json["id"] as String,
      object: json["object"] as String,
      sessionId: json["sessionId"] as String,
      createdAt: json["createdAt"] as int,
      mediaMode: json["mediaMode"] as String,
      recordingMode: json["recordingMode"] as String,
      customSessionId: json["customSessionId"] as String,
      recording: json["recording"] as bool,
      forcedVideoCodec: json["forcedVideoCodec"] as String,
      allowTranscoding: json["allowTranscoding"] as bool,
      defaultRecordingProperties:
          RoomRecordingProperty.fromJson(json["defaultRecordingProperties"]),
      connections: RoomConnections.fromJson(json["connections"]),
    );
  }
}
